<template>
	<view class="template-shop tn-safe-area-inset-bottom">
		<!-- 顶部自定义导航 -->
		<tn-nav-bar fixed alpha customBack>
			<view slot="back" class='tn-custom-nav-bar__back' @click="goBack">
				<text class='icon tn-icon-left'></text>
				<text class='icon tn-icon-home-capsule-fill'></text>
			</view>
		</tn-nav-bar>


		<view class="tabbar footerfixed-top dd-glass" style="border-radius: 100rpx;">
			<view class="action">
				<view class="bar-icon">
					<view class="tn-icon-company tn-color-grey--dark">
					</view>
				</view>
				<view class="tn-color-grey--dark">北北山庄</view>
			</view>
			<view class="action" @click="callPhoneNumber" data-number="18219126666">
				<view class="bar-icon">
					<view class="tn-icon-tel tn-color-grey">
					</view>
				</view>
				<view class="tn-color-gray">电话</view>
			</view>
			<view class="action" @click="showModal">
				<view class="bar-icon">
					<view class="tn-icon-wechat tn-color-grey">
					</view>
				</view>
				<view class="tn-color-gray">微信</view>
			</view>
			<view class="action" @click="openLocation">
				<view class="bar-icon">
					<view class="tn-icon-map tn-color-grey"></view>
				</view>
				<view class="tn-color-gray">导航</view>
			</view>
		</view>

		<view class="page-body-movable">
			<view class="">
				<movable-area>
					<movable-view :x="x" :y="y" :scale="true" direction="all" @change="onChange">text</movable-view>
				</movable-area>
			</view>
		</view>


		<!-- 底部tabbar start-->
		<view class="tabbar footerfixed dd-glass" style="border-radius: 100rpx;">
			<view class="action">
				<view class="bar-icon">
					<view class="tn-icon-company tn-color-grey--dark">
					</view>
				</view>
				<view class="tn-color-grey--dark">加收藏</view>
			</view>
			<view class="action" @click="callPhoneNumber" data-number="18219126666">
				<view class="bar-icon">
					<view class="tn-icon-tel tn-color-grey">
					</view>
				</view>
				<view class="tn-color-gray">加文字</view>
			</view>
			<view class="action" @click="showModal">
				<view class="bar-icon">
					<view class="tn-icon-wechat tn-color-grey">
					</view>
				</view>
				<view class="tn-color-gray">加图片</view>
			</view>
			<view class="action" @click="openLocation">
				<view class="bar-icon">
					<view class="tn-icon-map tn-color-grey"></view>
				</view>
				<view class="tn-color-gray">导航</view>
			</view>
		</view>


	</view>
</template>

<script>
	import template_page_mixin from '@/libs/mixin/template_page_mixin.js'
	export default {
		name: 'TemplateShop',
		mixins: [template_page_mixin],
		data() {
			return {
				x: 0,
				y: 0,
				old: {
					x: 0,
					y: 0
				}
			}
		},
		methods: {
			tap(e) {
				this.x = this.old.x
				this.y = this.old.y
				this.$nextTick(function() {
					this.x = 30
					this.y = 30
				})
			},
			onChange(e) {
				this.old.x = e.detail.x
				this.old.y = e.detail.y
			},
			tn(e) {
				uni.navigateTo({
					url: e,
				});
			},
			openLocation() {
				uni.openLocation({
					longitude: 113.3298396012573,
					latitude: 22.961803525530176,
					name: '祈福新村',
					address: '祈福新村'
				})
			},
			//拨打固定电话
			callPhoneNumber() {
				uni.makePhoneCall({
					phoneNumber: "18219126666",
				});
			},

			// 弹出模态框1
			showModal(event) {
				this.openModal()
			},
			// 打开模态框
			openModal() {
				this.show1 = true
			}
		}
	}
</script>

<style lang="scss" scoped>
	
	.page-body-movable{
		movable-view {
			display: flex;
			align-items: center;
			justify-content: center;
			height: 150rpx;
			width: 150rpx;
			background-color: #007AFF;
			color: #fff;
		}
		
		movable-area {
			height: 100vh;
			width: 100%;
			background-color: #D8D8D8;
			overflow: hidden;
		}
	}

	/* 胶囊*/
	.tn-custom-nav-bar__back {
		width: 100%;
		height: 100%;
		position: relative;
		display: flex;
		justify-content: space-evenly;
		align-items: center;
		box-sizing: border-box;
		background-color: rgba(0, 0, 0, 0.15);
		border-radius: 1000rpx;
		border: 1rpx solid rgba(255, 255, 255, 0.5);
		color: #FFFFFF;
		font-size: 18px;

		.icon {
			display: block;
			flex: 1;
			margin: auto;
			text-align: center;
		}

		&:before {
			content: " ";
			width: 1rpx;
			height: 110%;
			position: absolute;
			top: 22.5%;
			left: 0;
			right: 0;
			margin: auto;
			transform: scale(0.5);
			transform-origin: 0 0;
			pointer-events: none;
			box-sizing: border-box;
			opacity: 0.7;
			background-color: #FFFFFF;
		}
	}

	.footerfixed-top {
		position: fixed;
		margin: 40rpx 30rpx;
		width: 690rpx;
		top: 100rpx;
		z-index: 999;
		background-color: rgba(255, 255, 255, 0.5);
		box-shadow: 0rpx 0rpx 30rpx 0rpx rgba(0, 0, 0, 0.07);
	}


	/* 底部tabbar start*/
	.footerfixed {
		position: fixed;
		// margin: 20rpx;
		margin: 40rpx 30rpx;
		width: 690rpx;
		bottom: calc(env(safe-area-inset-bottom) / 2);
		z-index: 999;
		background-color: rgba(255, 255, 255, 0.5);
		box-shadow: 0rpx 0rpx 30rpx 0rpx rgba(0, 0, 0, 0.07);
	}

	.tabbar {
		display: flex;
		align-items: center;
		min-height: 110rpx;
		justify-content: space-between;
		padding: 0;
		height: calc(110rpx + env(safe-area-inset-bottom) / 2);
		// padding-bottom: calc(env(safe-area-inset-bottom) / 2);
	}

	.tabbar .action {
		font-size: 22rpx;
		position: relative;
		flex: 1;
		text-align: center;
		padding: 0;
		display: block;
		height: auto;
		line-height: 1;
		margin: 0;
		overflow: initial;
	}

	.tabbar .action .bar-icon {
		width: 100rpx;
		position: relative;
		display: block;
		height: auto;
		margin: 0 auto 10rpx;
		text-align: center;
		font-size: 42rpx;
	}

	.tabbar .action .bar-icon image {
		width: 50rpx;
		height: 50rpx;
		display: inline-block;
	}

	/* 毛玻璃*/
	.dd-glass {
		width: 690rpx;
		backdrop-filter: blur(20rpx);
		-webkit-backdrop-filter: blur(20rpx);
	}
</style>